package com.urick.spi.dubbo;

import com.urick.spi.dubbo.common.URL;
import com.urick.spi.dubbo.compiler.support.AdaptiveCompiler;
import com.urick.spi.dubbo.compiler.support.JavassistCompiler;
import com.urick.spi.dubbo.ext.IAdaptiveExt;
import com.urick.spi.dubbo.ext.IExtResult;
import org.junit.Assert;
import org.junit.Test;

/**
 * Design Theories: 自适应拓展实现
 * <a href=""></a>
 *
 * @author uRick 2021/12/13 11:17
 * Email: rickwork@163.com
 * Wechat: yy3076815642
 * QQ: 3076815642
 * @since 1.0
 */
public class AdaptiveTester {
    @Test
    public void adaptiveTester() {
        AdaptiveCompiler.setDefaultCompiler(JavassistCompiler.NAME);
        ExtensionLoader<IAdaptiveExt> extensionLoader = ExtensionLoader.getExtensionLoader(IAdaptiveExt.class);
        IAdaptiveExt adaptiveExtension = extensionLoader.getAdaptiveExtension();
        URL url = URL.valueOf("test://localhost?IAdaptiveExt_Value=adaptive1");
        IExtResult exe = adaptiveExtension.exe(url);
//        Assert.assertNull(exe);
        Assert.assertEquals(IExtResult.checkOk(exe), Boolean.TRUE);
    }
}